########################################################################
# PLACE LIST CREATIONS HERE #
########################################################################
stage_list = ["moon", "mars", "jupiter", "pluto", "space", "city"]
head_list = ["head1", "head2", "head3", "head4", "head5", "head6"]
########################################################################
# PLACE ALL OTHER CODE BELOW THIS #
########################################################################
stage_image = stage_list[1]
stage.set_background(stage_image)
random_head = random.randint(0, 5)
head_image = head_list[random_head]
# sprite = codesters.Sprite("image", x, y)
head = codesters.Sprite(head_image, 0, 83)
t = codesters.Teacher()
try:
tval1 = body_list
tval2 = len(body_list)
tval3a = t.find_text('body_list')[0][1]
tval3 = tval3a.count(',')
except:
tval1 = "DNE"
tval2 = "DNE"
tval3 = "DNE"
t1 = TestObjective()
t1.add_success('middle1' in tval1 and 'middle2' in tval1 and 'middle3' in tval1 and 'middle4' in tval1 and 'middle5' in tval1 and 'middle6' in tval1 and tval2 == 6, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you create a list named body_list?")
t1.add_failure(tval2 == 3, "Did you add three more values to the list?")
t1.add_failure(tval2 < 6, "Oops! Make sure your list has six values in it, all separated by commas.")
t1.add_failure(tval2 > 6, "Did you add extra values to your list?")
t1.add_failure(tval3 < 5, "Make sure all the values in your list are separated by commas.")
t1.add_failure('cat' in tval1 or 'dog' in tval1 or 'pig' in tval1, "Did you change the three values in the original list?")
t1.add_failure(tval1 != ["middle1", "middle2", "middle3", "middle4", "middle5", "middle6"], "Are all the values in your body_list correct?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)